import { defineStore } from 'pinia'

// 定义一个名为useCounterStoreB的store
export const useCounterStoreB = defineStore('storesB', {
  // 定义state
  state: () => ({
    // 是否添加状态
    addState: false,
    seekObject: 0,
    rowId: 0,
    // 标题状态
    titleState: '',
    // 路径
    path: 'users',
    rowObject: {
      // id
      id: 0,
      // 邮箱
      email: '',
      // 姓名
      name: '',
      // 电话
      phone: 0,
      // 角色
      role: '',
    },
    roleName: '',
    roleDesc: '',
    jurisdictionObj: {},
    cat_id: 0,
    cat_name: '',
    cat_state: true,
  }),
  // 定义actions
  actions: {
    // 设置是否添加状态
    stateFun(i: boolean) {
      this.addState = i
    },
    // 设置查询对象
    seekObjectFun(i: number) {
      this.seekObject = i
    },
    // 设置行id
    rowIdFun(i: number) {
      this.rowId = i
    },
    // 设置标题状态
    titleStateFun(i: string) {
      this.titleState = i
    },
    // 设置行对象
    rowObjectFun(date: number, name: string, email: string, phone: number, role: string) {
      this.rowObject.id = date
      this.rowObject.email = email
      this.rowObject.name = name
      this.rowObject.phone = phone
      this.rowObject.role = role
    },
    // 设置路径
    pathFun(i: string) {
      this.path = i
    },
    roleNameFun(i: string) {
      this.roleName = i
    },
    roleDescFun(i: string) {
      this.roleDesc = i
    },
    jurisdictionObjFun(i: object) {
      this.jurisdictionObj = i
      // console.log('jurisdictionObj', this.jurisdictionObj)
    },
    cat_idFun(i: number) {
      this.cat_id = i
    },
    cat_nameFun(i: string) {
      this.cat_name = i
    },
    cat_stateFun(i: boolean) {
      this.cat_state = i
    },
  },
})
